<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        body{
            height:3000px;
        }
        #box{
            height:100px;
            width:100px;
            margin-top:1000px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="box"></div>
    <script>
        //es6 新增
        //元素与可视窗口的交叉坐标位置信息  top left bottom  right
        var  ele= box.getBoundingClientRect();
        console.log(ele.top);
        console.log(ele.bottom);
        console.log(ele.left);
        console.log(ele.right);
    </script>
</body>
</html>